package com.example.demo.web;

import com.example.demo.comm.DemoInfo;
import com.example.demo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author lenovo
 */
@RestController
public class HelloController {
    //@Value("${com.example.name}")
    //private String name;
    //@Value("${com.example.email}")
    //private String email;
    @Resource
    private DemoInfo demoInfo;

    @Autowired
    private DemoService demoService;

    @RequestMapping("/hello")
    public String hello(){
        String msg = demoService.sayHello();
        msg += " " + demoInfo.getName() + " " + demoInfo.getEmail();
        return msg;
    }
}